<?php

require_once('util.php');

class Disciplina extends CI_Controller{

	public function __construct() {
		parent::__construct();	
		$this->load->model('disciplina_model');
	}

	public function cadastrar(){
		Util::show($this, 'disciplina/cadastrar');
	}

	public function salvar(){
		$this->disciplina_model->salvar();	
		echo 'ok';
	}

	public function listar(){
		Util::show($this, 'disciplina/listar');
	}

	public function remover(){
		$this->disciplina_model->delete();
		echo 'Usuário removido com sucesso';
	}

	public function consultar(){
		$data['disciplinas'] = $this->disciplina_model->listar();
		$this->load->view('disciplina/disciplina_table', $data);	
	}

	public function show_info_json(){
		$data['disciplina'] = $this->disciplina_model->consultar_por_id();
		echo json_encode($data['disciplina']);
	}

}

?>